package com.iotechn.unimall.admin.myapi.course;

import com.iotechn.unimall.core.annotation.HttpMethod;
import com.iotechn.unimall.core.annotation.HttpOpenApi;
import com.iotechn.unimall.core.annotation.HttpParam;
import com.iotechn.unimall.core.annotation.HttpParamType;
import com.iotechn.unimall.core.annotation.param.NotNull;
import com.iotechn.unimall.core.exception.ServiceException;
import com.iotechn.unimall.mydata.domain.CourseBean;
import org.springframework.http.ResponseEntity;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;

@HttpOpenApi(group = "course.course",description = "首页主课程")
public interface ICourseService {

    @HttpMethod(description = "创建父课程信息")
    String createParent(
            @NotNull @HttpParam(name="title",type = HttpParamType.COMMON, description = "标题") String title
    ) throws ServiceException;

//    @HttpMethod(description = "创建子课程信息")
//    String createSon(
//            @NotNull @HttpParam(name="title",type = HttpParamType.COMMON, description = "标题") String title,
//            @NotNull @HttpParam(name="parentId",type = HttpParamType.COMMON, description = "所属父母id") Long parentId,
//            @NotNull @HttpParam(name="upload",type = HttpParamType.COMMON, description = "文件") MultipartFile upload
//    ) throws ServiceException, IOException;

    @HttpMethod(description = "根据资料名称找到资料并返回")
    ResponseEntity<byte[]> download(
            @NotNull @HttpParam(name="filename",type = HttpParamType.COMMON, description = "资料名称") String filename
    ) throws ServiceException, IOException;


    @HttpMethod(description = "修改课程信息")
    String update(
            @NotNull @HttpParam(name="courseId",type = HttpParamType.COMMON, description = "课程id") Long courseId,
            @NotNull @HttpParam(name="title",type = HttpParamType.COMMON, description = "标题") String title,
            @NotNull @HttpParam(name="parentId",type = HttpParamType.COMMON, description = "所属父母id") Long parentId
    ) throws ServiceException;

    @HttpMethod(description = "删除课程信息")
    String delete(
            @NotNull @HttpParam(name="courseId",type = HttpParamType.COMMON, description = "课程id") String courseId
    ) throws ServiceException;

    @HttpMethod(description = "返回所有父课程名字")
    List<String> returnParentName(
    ) throws ServiceException;

    @HttpMethod(description = "返回所有父课程详细信息")
    List<CourseBean> returnParent(

    ) throws ServiceException;

    @HttpMethod(description = "根据父课程的名字找出所有子课程")
    List<CourseBean> getSon(
            @NotNull @HttpParam(name="parentId",type = HttpParamType.COMMON, description = "所属父母id") Long parentId
    ) throws ServiceException;
}
